{include file="public/header" /} 	    	
		<!-- Start right content -->
        <div class="content-page">
			<!-- ============================================================== -->
			<!-- Start Content here -->
			<!-- ============================================================== -->
            <div class="content">
								<!-- Page Heading Start -->
				<div class="page-heading">
            		<h1><i class='fa fa-table'></i>管理员角色列表</h1>
            	</div>
            	<!-- Page Heading End-->				<!-- Your awesome content goes here -->

				<div class="row">
					<div class="col-md-12">
						<div class="widget">
							<div class="widget-header transparent">
								<h2><strong>角色</strong> 列表</h2>
								<div class="additional-btn">
									<a href="#" class="hidden reload"><i class="icon-ccw-1"></i></a>
									<a href="#" class="widget-toggle"><i class="icon-down-open-2"></i></a>
									<a href="#" class="widget-close"><i class="icon-cancel-3"></i></a>
								</div>
							</div>
							<div class="widget-content">
								<div class="data-table-toolbar">
									<div class="row">
										<div class="col-md-4">
											<form role="form">
											<input type="text" class="form-control" placeholder="搜索...">
											</form>
										</div>
										<div class="col-md-8">
											<div class="toolbar-btn-action">
												<a href="{:url('admin/admin/addroles')}" class="btn btn-success"><i class="fa fa-plus-circle"></i> 添加</a>
												<a class="btn btn-primary"><i class="fa fa-refresh"></i> 刷新</a>
											</div>
										</div>
									</div>
								</div>
									
								<div class="table-responsive">
									<table data-sortable class="table table-hover table-striped">
										<thead>
											<tr>
												<th>序号</th>
												<th>名称</th>
												<th>角色</th>
												<th data-sortable="false">操作</th>
											</tr>
										</thead>
										
										<tbody>
											{volist name="power" key="k" id="v"}
											<tr>
												<td>{$v['id']}</td>
												<td><strong>{$v['name']}</strong></td>
												<td>{$v['limit']}</td>
												<td>
													<div class="btn-group btn-group-xs">
														<a href="{:url('admin/admin/editroles',['id'=>$v['id']])}" data-toggle="tooltip" title="编辑" class="btn btn-success edit-btn"><i class="fa fa-edit"> 编辑 </i></a>
														<button data-id="{$v['id']}" class="btn btn-danger btn-sm del-btn"><i class="fa fa-trash-o"> 删除 </i></button>
													</div>
												</td>
											</tr>
											{/volist}
										</tbody>
									</table>
								</div>
									
								<div class="data-table-toolbar">
									<ul class="pagination">
									  <li class="disabled"><a href="#">&laquo;</a></li>
									  <li class="active"><a href="#">1</a></li>
									  <li><a href="#">2</a></li>
									  <li><a href="#">3</a></li>
									  <li><a href="#">4</a></li>
									  <li><a href="#">5</a></li>
									  <li><a href="#">&raquo;</a></li>
									</ul>
								</div>
							</div>
						</div>
					</div>
						
				</div>

				            <!-- Footer Start -->
{js href="/static/index/js/jquery.min.js"}
<script>
    $(function (){
        // 触发用户删除
        $('.del-btn').click(function (){
            var ac_id = $(this).attr('data-id');
            console.log('删除操作, ID: ' + ac_id);
            
            if (confirm('您确定要[ 删 除 ]吗?')) {
                var obj = $(this).parents('tr');
                console.log(obj); //要删除的元素节点
                delAjax(ac_id, obj);
            }
        });
    });

    // 执行AJAX删除
    function delAjax(id,obj) {
        $.ajax({
            type : 'delete', // delete方式
            url  : "delroles/id/" + id, // 路由+参数
            dataType : 'json',
            success : function (data){
                if (data.status) {
                	alert('删除成功!');
                    // 将该TR移除掉
                    obj.remove();
                }
            },
            error : function () {
                alert('删除失败');
            }
        });
    }
</script>

{include file="public/footer" /}